<template>
  <div>
    <div class="pageheader flexbetween">
      <div>
        <div
          v-for="(item, index) in list"
          :key="index"
          class="pageitem commhover c_text f-14 fw-6"
          :class="{ active: activeId === item.id }"
          @click="handleTab(item)"
        >
          {{ item.name }}
        </div>
      </div>
      <el-button
        type="primary"
        plain
        size="small"
        v-hasPermi="['system:batchgrouping:datastatistics']"
        @click="goPage('/communityOperation/batchgrouping/datastatistics')"
        >数据统计</el-button
      >
    </div>
    <div class="pagewrapper2">
      <batch-page :key="keys" :repoType="activeId" />
    </div>
  </div>
</template>
<script>
import BatchPage from "./BatchPage.vue";
// import { mapGetters } from "vuex";
export default {
  data() {
    return {
      list: [
        { name: "近2周记录", id: 1 },
        { name: "2周前记录", id: 2 },
      ],
      activeId: 1,
      keys: "",
    };
  },
  components: {
    BatchPage,
  },
  methods: {
    handleTab(item) {
      this.activeId = item.id;
      this.keys = Date.now();
      console.log("item:", item, this.activeId);
      //   this.$router.push({name:item.name})
    },

    goPage(path) {
      this.$router.push({ path });
    },
  },
};
</script>
<style lang="scss" scoped>
.pageheader {
  width: 100%;
  height: 46px;
  position: sticky;
  top: 0;
  z-index: 8;
  height: 46px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #e9e9e9;
}
.pageitem {
  display: inline-block;
  height: 100%;
  line-height: 46px;
  border-bottom: 2px solid transparent;
  width: auto;

  &.active {
    color: #3070ff;
    border-bottom-color: #3070ff;
  }
  &:not(:first-child) {
    margin-left: 32px;
  }
}
.pagewrapper2 {
  padding: 16px;
  padding-bottom: 0;
  height: calc(100vh - 48px - 46px);
}
</style>
